<?php
/**
 * @author 		supfire
 * @copyright		ourMY.com
 * @version 		1.0
 * @name 		key.func.php
 * @todo 		处理密钥函数
 * @final 		2008-09-16
 */
!defined("IN_YCTOOL") && exit();

/**
 * CODE 获取秘钥方法
 *
 */
function codeconfig($userid, $userpath)
{
    if (!file_exists($userpath.'config/code.php'))
    {
	$str = "0123456789abcdefghijklmnopqrstuvwxyz";
	$str = substr(str_shuffle($str), 0, 6);
	$variablecode = array();
	$variablecode[$userid]["code"] = $str;
	func::operateFile('variablecode', $variablecode, $userpath.'config/code', 'php', 2);
    }
    else
    {
	include_once($userpath.'config/code.php');
    }
    return $variablecode[$userid]["code"];
}

/**
 * 密钥 加密
 */
function codeEn($key, $code)
{
    return md5($key . $code);
}

?>
